<template>
<div>
    <el-table
      :data="list"
      style="width: 100%">
      <el-table-column
        width="300">
        <template slot-scope="scope">
            <a :href="'/course/'+scope.row.courseId"><img :src="scope.row.courseCover" height="150px" width="260px"></a>
        </template>
      </el-table-column>
            <el-table-column
        width="520">
        <template slot-scope="scope">
            <span>{{scope.row.gmtCreate}}&emsp;|&emsp;订单号:{{scope.row.orderNo}}&emsp;|&emsp;{{scope.row.payType===1?'微信支付':'支付宝支付'}}</span>
        </template>
      </el-table-column>
      <el-table-column
        width="270">
        <template slot-scope="scope">
            <span style="font-weight: bold;">应付金额 ：{{scope.row.totalFee}}元</span>
        </template>
      </el-table-column>
      <el-table-column
        width="170">
        <template slot-scope="scope">
            <span v-if="scope.row.status===1" style="font-weight: bold;font-size:16px">已支付</span>
            <span v-else style="font-weight: bold;font-size:16px"><a :href="'/orders/'+scope.row.orderNo" style="color:red;">未支付，点击去支付</a></span>
        </template>
      </el-table-column>
    </el-table>
    </div>
</template>

<script>
import order from "@/api/order"
import cookie from "js-cookie";
export default {
    data(){
        return{
            loginInfo:{},
            list:[]
        }
    },
    methods:{
        //获取用户订单集合
        getList(){
            order.getOrderByMember(this.loginInfo.id).then(resp=>{
                this.list=resp.data.data.list
                console.log(resp.data.data)
                console.log(this.loginInfo.id)
        })
        },
        //去支付订单页面
        pay(){

        }
    },
    created(){
        //从cookie中获取信息
        var userStr =cookie.get("guli_ucenter");
        //转字符串转换成json对象(js对象)
        if (userStr) {
            this.loginInfo = JSON.parse(userStr);
        }
        this.getList()
    }
}
</script>

<style>

</style>
